import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '@/layout/index'

const routes = [
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/login/index.vue'),
  },
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Home',
        component: () => import('@/views/home/index.vue'),
        meta: { name: '首页' },
      },
      {
        path: 'article/:articleId',
        name: 'Article',
        component: () => import('@/views/article/index.vue'),
        meta: { name: '文章', hidden: true, back: true },
      },
    ],
  },
  {
    path: '/inventory',
    component: () => import('@/views/inventory/index.vue'),
    meta: { name: '评测' },
    children: [
      {
        path: 'sds',
        component: () => import('@/views/inventory/SDS.vue'),
        name: 'SDS',
        meta: { name: '每日SDS量表', hidden: true },
      },
      {
        path: 'hcl',
        component: () => import('@/views/inventory/HCL.vue'),
        name: 'HCL',
        meta: { name: '每日HCL-32量表', hidden: true },
      },
    ],
  },
  {
    path: '/sheet',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Sheet',
        component: () => import('@/views/sheet/index.vue'),
        meta: { name: '量表', hidden: false },
      },
    ],
  },
  {
    path: '/consult',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Consult',
        component: () => import('@/views/consult/index.vue'),
        meta: { name: '咨询', hidden: false },
      },
    ],
  },
  {
    path: '/individual',
    component: Layout,
    children: [
      {
        path: '',
        name: 'Individual',
        component: () => import('@/views/individual/index.vue'),
        meta: { name: '个人', hidden: false },
      },
      {
        path: 'test',
        name: 'MyTest',
        component: () => import('@/views/my-test/index.vue'),
        meta: { name: '我的测验', hidden: true, back: true },
      },
      {
        path: 'result',
        name: 'MyResult',
        component: () => import('@/views/my-result/index.vue'),
        meta: { name: '测验结果', hidden: true, back: true }
      }
    ],
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes,
})

export default router
